<?php

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

function union_types( int   |   float   |  bool   |  string  |  array  |  object  | iterable | callable|   Type1| null $param1): iterable   |    false | Type1 |null {
    return null;
}

$closure = function(  Type1  |  \Union\Type2|  null $param1, callable  |  false $prame2): \Union\Type1  |int|   float| null {
    return null;
};

$af = fn(        Type2    |  int| string $param1): \Union\Type1   |   string |   null => new Type1();

class UnionTypes
{
    private Type1   |   Type2 |  null $unionTypes1;
    public static     parent  |  self $unionTypes2;

    public function testMethod(    int   |  float |  bool |string|         array| Type2|object|     iterable|   callable |    \Union\Type1  |  null $param1): iterable  |false  | Type1    |  null {
        return null;
    }

    public static function testStaticMethod(   self|   parent   |    null $param1, iterable    |     false $param2): self   |   parent  |    null {
        return null;
    }
}

trait UnionTypesTrait
{
    public    Type1       |       \Union\Type2  |  null $test1;
    public static   int  |float   | string   |array|object|   iterable  | null $test2;

    public function testMethod(
              int  |  float|bool   |   string|   array|   Type2   |   object   |     iterable | callable   |   \Union\Type1   |   null $param1,
                 iterable  |  false $param2,
    ):     iterable  |   false |    Type1|   null {
        return null;
    }
}
